package com.example.interpreter;

import java.util.Map;

public class GratterExpression implements Expression {

    private String key;
    private Integer value;

    public GratterExpression(String rule) {
        this.key = rule.split(">")[0].trim();
        this.value = Integer.parseInt(rule.split(">")[1].trim());
    }

    @Override
    public boolean interpret(Map<String, Integer> stat) {
        if (!stat.containsKey(key)) {
            return false;
        }
        Integer userVal = stat.get(this.key);
        return userVal > this.value;
    }
}
